<?php
/**
 * Created by PhpStorm.
 * User: wangye
 * Date: 19-3-11
 * Time: 下午10:41
 */
$arr = range('a','z');

//print_r($arr);

//foreach ($arr as $key => $value) {
//    echo $key.' : '.$value;
//    echo '<br>';
//}

$str = '2,3,5,19,39';
$arr = explode(',',$str); # 更具规则吧str变为array
//echo array_sum($arr); # 求和
//echo '<br>';
//echo array_product($arr); # 求积
//
//echo '<br>';

$allowExts = ['jpg','jpeg','gif','png'];
$filename = '1.txt.php.jpg';
$arr = explode('.',$filename);
$ext = end($arr);
var_dump(in_array($ext,$arr));

$arr = ['a','b','c'];
$res = array_pop($arr);
$res = array_unshift($arr,'mf'); //返回数组长度
echo $res;
print_r($arr);


echo '<br>';

$str1 = join('',range(0,100)); // 通过"",链接arr称为新str
echo $str1;
echo '<br>';

function zm($a) {
    $arr1 = range(0,9);
    $arr2 = range('a','z');
    $arr3 = range('A','Z');
    $newArr = array_merge($arr1,$arr2,$arr3);
//    print_r($newArr);
    $str = '';
    for($i=1;$i<=$a;$i++) {
        $str.=$newArr[mt_rand(0,count($newArr)-1)];
    }
    return $str;
}

echo zm(5);

